<?php

class ConexionBD{
	private $host;
	private $user;
	private $pass;
	private $db;
	public $cnx;
	public $consulta;
	public $assoc;
	
	function conectar(){
		
		$this->host = 'localhost';
		$this->user = 'root';
		$this->pass = '';
		$this->db = 'practicario';
		$GLOBALS=$this->cnx = mysql_connect($this->host, $this->user, $this->pass);
		mysql_select_db($this->db, $this->cnx);
	
	}
	function enviarQuery($query){

		$this->consulta=mysql_query($query, $GLOBALS);
	}

	
	function resultadoQuery()
	{	
		while($this->assoc=mysql_fetch_assoc($this->consulta))
		{
			$row[]=$this->assoc;		
		}
		
		return $row;
	
	}
	
	function closeConexion()
	{
			mysql_close($GLOBALS); 
	}
 	
}


?>